import pymysql

db = pymysql.connect(
        host='192.168.28.59',
        port=3306,
        user='fjyl_wujun',
        password='SU2RZvgV3eCS5Bpq',
        charset='utf8',
        database='lbwan_v4_user_db'
    )
file_username = open(r'unity_username.txt', mode='r')
sql_name = file_username.read()
cur = db.cursor()
cur.execute("SELECT realname_status FROM user_main WHERE user_name = %s",sql_name)
name = cur.fetchall()
Real_name = name[0][0]
print(Real_name)
if Real_name == 3:
        print("实名认证数据库验证成功")
else:
        print("实名认证数据库验证失败")

db = pymysql.connect(
        host='192.168.28.45',
        port=3306,
        user='fjyl_wujun',
        password='SU2RZvgV3eCS5Bpq',
        charset='utf8',
        database='authcenter'
    )
cur = db.cursor()
cur.execute("SELECT session_id FROM behavior_login_lbwanh5_251 WHERE session_status = 1;")
name = cur.fetchall()
Heat_name1 = name[0][0]
print(Heat_name1)
cur.execute("SELECT session_id FROM behavior_online_lbwanh5_251")
name2 = cur.fetchall()
Heat_name2 = name2[0][0]
print(Heat_name2)
if Heat_name1 == Heat_name2:
        print("心跳数据库验证成功")
else:
        print("心跳数据库验证失败")
print('H5游戏--UI自动化测试结束')